package com.bleeth.flow.step.input;

import cn.hutool.json.JSONObject;
import com.bleeth.flow.core.common.APlugin;
import com.bleeth.flow.core.common.PluginAnnotation;
import com.bleeth.flow.core.common.PluginTypeEnum;
import com.jd.platform.async.wrapper.WorkerWrapper;
import lombok.Data;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;

import java.util.List;
import java.util.Map;

/**
 * @author ：Bleeth
 * @date ：2021-08-05
 * @description：数据生成器，我们只是数据的搬运工
 */
@Data
@PluginAnnotation(name = "自定义聚合",
        type = PluginTypeEnum.AGG,
        description = "",
        id = "DataFactoryPlugin")
public class DataFactoryPlugin extends APlugin {

    private Integer DEFAULT_ROW_NUM = 10000 * 10;

    private Integer limitRowNum;

    private List<FieldConfigBean> fieldList;




    @Override
    public Dataset<Row> action(Dataset<Row> input, Map<String, WorkerWrapper> allWrappers) {
        //配置


        return null;
    }


    public static class FieldConfigBean {

        private String fieldName;

        private String fieldType;

        private String prefix;

        private String suffix;

        //动态参数
        private JSONObject paramObject;
    }
}
